<?php
/**
 * controller.nct.core.php file
 *
 * PHP Version 5
 *
 * DateCreated - December 2, 2011
 * DateModified - December 5, 2011
 * 
 * @category  Core
 * @package   Core
 * @author    Ervin Musngi <ervinmusngi@gmail.com>
 * 
 * @copyright 2011 Ervin Musngi
 * @license   http://netcoretech.com Net-Coret-Tech
 * @version   SVN: <tortoise>
 * @link      http://netcoretech.com/php/
 * 
 */

/**
 * Controller Class
 *
 * DateCreated - December 2, 2011
 * DateModified - December 5, 2011
 * 
 * Main Controller Abstract Class to be inherited by other Controller Classes
 * 
 * @category  Core
 * @package   Core
 * @author    Ervin Musngi <ervinmusngi@gmail.com>
 * 
 * @copyright 2011 Ervin Musngi
 * @license   http://netcoretech.com Net-Coret-Tech
 * @link      http://netcoretech.com/php/
 * 
 */
abstract class Controller
{
    
    private static $_instance;
    
    /**
     *@method __construct()
     * Initialize the instance of the whole controller class
     * Load classes that are specified on the autoload configuration.
     */
    public function __construct()
    {
        self::$_instance =& $this;
        
        foreach ( autoload_class() as $var => $class) {
            $this->$class =& load_class($class);
        }
        
        if ( isset( $this->config ) ) {
        
            foreach ( autoload_config() as $var => $class ) {
                $this->config->load($class);
            }
            
        }
        
        $this->load =& load_class('loader', 'core');
        $this->config =& load_class('config', 'core');
        
    }
    
    /**
     *@method &get_instance() 
     * Static method that will return the current 
     * object instance of the whole framework.
     * 
     * @return Controller Object Instance
     */
    public static function &get_instance()
    {
        return self::$instance;
    }
    
    
}